import initState from './state';
import {SHRINK_BOARD, SET_ACTIVE_CATEGORY, SELECT_ITEM, SET_HIGHLIGHT_CATEGORY} from './actionTypes'
let reducer = (prevState=initState,action)=>{
  let newData = JSON.parse(JSON.stringify(prevState))
  let { type,payload } = action
  switch (type) {
    case SHRINK_BOARD :
      newData.MenuShrink = payload;
      break;
    case SET_ACTIVE_CATEGORY :
      newData.activeCategory = payload;
      break;
    case SELECT_ITEM :
      newData.itemSelected = payload;
      break;
    case SET_HIGHLIGHT_CATEGORY :
      newData.highlightCategory = payload;
      break;
      
    default:
      break;
  }
  return newData
}
export default reducer
